/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.mcx.modules.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author mcx
* @date 2022-03-22
**/
@Entity
@Data
@Table(name="player")
public class Player implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "编号")
    private Integer id;

    @Column(name = "nick_name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "昵称")
    private String nickName;

    @Column(name = "status")
    @ApiModelProperty(value = "状态")
    private Integer status;

    @Column(name = "level")
    @ApiModelProperty(value = "等级")
    private Integer level;

    @Column(name = "sex")
    @ApiModelProperty(value = "性别")
    private Integer sex;

    @Column(name = "money")
    @ApiModelProperty(value = "金钱")
    private Integer money;

    @Column(name = "exp")
    @ApiModelProperty(value = "经验")
    private Integer exp;

    @Column(name = "curr_lineup_id")
    @ApiModelProperty(value = "当前阵容id")
    private Integer currLineupId;

    @Column(name = "curr_select_lineup_index")
    @ApiModelProperty(value = "当前阵容id")
    private Integer currSelectLineupIndex;

    @Column(name = "last_in_world_map_id")
    @ApiModelProperty(value = "最后进入地图id")
    private Integer lastInWorldMapId;

    @Column(name = "last_in_world_map_pos")
    @ApiModelProperty(value = "最后进入地图坐标")
    private String lastInWorldMapPos;

    @Column(name = "account_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "账号id")
    private Integer accountId;

    @Column(name = "gameserver_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "游戏服务器id")
    private Integer gameserverId;

    @Column(name = "createtime",nullable = false)
    @NotNull
    @CreationTimestamp
    @ApiModelProperty(value = "创建时间")
    private Timestamp createtime;

    @Column(name = "updatetime")
    @UpdateTimestamp
    @ApiModelProperty(value = "更新时间")
    private Timestamp updatetime;

    public void copy(Player source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}